<?php

namespace App\Console\Commands;

use App\Library\OSS;
use App\Modules\Course\Models\Reservation;
use App\Modules\Models\Admin;
use App\Modules\Notifications\BuyCourse;
use App\Modules\Order\Jobs\NewcomerJob;
use App\Modules\Order\Models\Order;
use App\Modules\Order\Models\SupportOrder;
use App\Modules\Payment\Models\WeChatPay;
use App\Modules\Payment\Models\WeChatRefund;
use App\Modules\Package\Models\GoodPackage;
use App\Modules\Shop\Shop;
use App\Modules\User\Manager;
use App\Modules\User\Models\User;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\QrCode;
use GuzzleHttp\Client;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;
use Ramsey\Uuid\Uuid;
use Overtrue\LaravelWeChat\Facade as EasyWeChat;
use Tymon\JWTAuth\Facades\JWTAuth;

class GetToken extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'token {id}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $id = $this->argument('id');
        $user = User::query()->find($id);
        $token = auth('api')->fromUser($user);
        auth('api')->setToken($token)->setUser($user);
        var_dump($token);
    }
}
